using System.Drawing;
using System.Collections.Generic;

namespace GeoSketch2.Core
{
    /// <summary>
    /// A class that contains the static variables for the application
    /// </summary>
    public static class Vars
    {
        /// <summary>
        /// A class that contains the mathematical constants for the application
        /// </summary>
        public static class Constants
        {
            /// <summary>
            /// The number PI
            /// </summary>
            public const double PI = 3.1415926535897932;
        }

        /// <summary>
        /// A class that contains the variables for the setup
        /// </summary>
        public static class Setup
        {
            /// <summary>
            /// A class that contains the variables for the setup of GeoObjects
            /// </summary>
            public static class DrawableObjects
            {
                /// <summary>
                /// A class that contains the variables for the drawing of GeoPoint
                /// </summary>
                public static class Point2D
                {
                    /// <summary>
                    /// To draw or not the id of the point
                    /// </summary>
                    public static bool DrawId = false;

                    /// <summary>
                    /// The radius of the cross on the screen (pixels)
                    /// </summary>
                    public static float CrossRadius = 5f;

                    /// <summary>
                    /// The font of the id
                    /// </summary>
                    public static Font IdFont = new Font(FontFamily.GenericSansSerif, 12f);
                }

                /// <summary>
                /// The next available id for the GeoObject
                /// </summary>
                public static int NextAvailableId = 0;
            }

            /// <summary>
            /// The setup for the forms
            /// </summary>
            public static class Forms
            {
                /// <summary>
                /// The setup of the image rectification form
                /// </summary>
                public static class ImageRectification
                {
                    /// <summary>
                    /// The active parent items for this form
                    /// </summary>
                    public static ActiveMDIParentItems ActiveParentItems = new ActiveMDIParentItems(false, false,true, false, false, true, false, false, false, false, false);
                }

                /// <summary>
                /// The setup of the pictures manager form
                /// </summary>
                public static class PictureManager
                {
                    /// <summary>
                    /// The extensions handled by the form
                    /// </summary>
                    public static string[] FilesExtension = new string[]{
                        "*.jpg",
                        "*.tif",
                        "*.tiff",
                        "*.png",
                    };

                    /// <summary>
                    /// The size of the thumbnails
                    /// </summary>
                    public static int ThumbnailsSize = 150;

                    /// <summary>
                    /// The space between the thumbnails
                    /// </summary>
                    public static int SpaceBetweenThumbnails = 12;
                }
            }

            /// <summary>
            /// The setup for the tools
            /// </summary>
            public static class Tools
            {
                /// <summary>
                /// The setup for the live zoom tool
                /// </summary>
                public static class TLiveZoom
                {
                    /// <summary>
                    /// The zoom factor, for example 1/20, means that a displacement of the mouse by 20 pixels is needed
                    /// to zoom X2 (2^1), 40 pixels = 2^2= zoom X4
                    /// </summary>
                    public static double ZoomFactor = 1 / 20.0;
                }

                /// <summary>
                /// The setup for the magnifier tool
                /// </summary>
                public static class TMagnifier
                {
                    /// <summary>
                    /// The zoom factor
                    /// </summary>
                    public static double ZoomFactor = 4;
                }

                /// <summary>
                /// The setup for the zoombox tool
                /// </summary>
                public static class TZoomBox
                {
                    /// <summary>
                    /// The pen of the sketch
                    /// </summary>
                    public static Pen SketchPen = new Pen(Color.Red, 2);

                }

                /// <summary>
                /// The setup for the selection tool
                /// </summary>
                public static class TSelection
                {
                    /// <summary>
                    /// The maximum distance to accept the object is near to the clic (pixels)
                    /// </summary>
                    public static double IsNearDistance = 5;

                    /// <summary>
                    /// The maximum distance to accept the object is near to the clic (pixels)
                    /// </summary>
                    public static Pen SelectionPen = new Pen(Color.Cyan, 3);
                }
            }

            /// <summary>
            /// The setup of standard object (primitives)
            /// </summary>
            public static class StandardObjects
            {
                /// <summary>
                /// The setup of layers
                /// </summary>
                public static class Layer
                {
                    /// <summary>
                    /// The next available display order, they must follow, no gap, 0 is the layer at the bottom, the max is the layer at the top
                    /// </summary>
                    public static int NextAvailableDisplayOrder = 0;

                    /// <summary>
                    /// The side length of the image of layer menu
                    /// </summary>
                    public static int MenuItemsImageSize = 20;

                    /// <summary>
                    /// The color of the layer menu item if the layer is invisible
                    /// </summary>
                    public static Color MenuItemsLayerInvisible = Color.Silver;
                }

                /// <summary>
                /// The setup of thumbnail box object
                /// </summary>
                public static class ThumbnailBox
                {
                    /// <summary>
                    /// The space between the image and the filename
                    /// </summary>
                    public const int SpaceBetweenDisplayBoxAndLabel = 5;
                }

                /// <summary>
                /// A class that contains the variables for the image rectification object
                /// </summary>
                public static class ImageRectification
                {
                    /// <summary>
                    /// Threshold for the detection of the cross (under the threshold the pixel doesn't belong to the cross anymore)
                    /// </summary>
                    public const byte CrossColorThreshold = 110;

                    /// <summary>
                    /// The radius of the blue cross (1000 mm)
                    /// </summary>
                    public const double BlueCrossRadius = 1000;

                    /// <summary>
                    /// The radius of the red cross (2000 mm)
                    /// </summary>
                    public const double RedCrossRadius = 2000;

                    /// <summary>
                    /// The radius of the green cross (500 mm)
                    /// </summary>
                    public const double GreenCrossRadius = 500;
                }

                /// <summary>
                /// A class that contains the variables for the line style object
                /// </summary>
                public static class LineType
                {
                    /// <summary>
                    /// Length of a dash
                    /// </summary>
                    public const float DashLength = 3f;

                    /// <summary>
                    /// Length of a space in a dashed line
                    /// </summary>
                    public const float DashSpaceLength = 3f;

                    /// <summary>
                    /// Length of a space in a dotted line
                    /// </summary>
                    public const float DotSpaceLength = 2f;

                    /// <summary>
                    /// The next available id of the Linetype object
                    /// </summary>
                    public static int NextAvailableId = 0;
                }

                /// <summary>
                /// The setup of the vieport object
                /// </summary>
                public static class Viewport
                {
                    /// <summary>
                    /// The background color of the object
                    /// </summary>
                    public static Color BackgroundColor = Color.White;

                    /// <summary>
                    /// The minimum size of the current view, to avoid buffer overflows
                    /// </summary>
                    public const double CurrentViewMinimumSize = 0.000001;
                }
            }

            /// <summary>
            /// The setup of the toolbars
            /// </summary>
            public static class Toolbars
            {
                /// <summary>
                /// The setup for the toolbar buttons
                /// </summary>
                public static class ToolbarButtons
                {
                    /// <summary>
                    /// The pen used to draw a half rectangle around the button when clicking left
                    /// </summary>
                    public static Pen LeftClickPen = new Pen(Color.Red, 3f);

                    /// <summary>
                    /// The pen used to draw a half rectangle around the button when clicking right
                    /// </summary>
                    public static Pen RightClickPen = new Pen(Color.Green, 3f);
                }

                /// <summary>
                /// The space between the button in the title bar
                /// </summary>
                public const int SpaceBetweenTitleButtons = 3;
            }

            /// <summary>
            /// The setup of GeoSketch
            /// </summary>
            public static class GeoSketch
            {
                /// <summary>
                /// The numberformat to define the decimal separator used in the program
                /// </summary>
                public static System.Globalization.NumberFormatInfo NumberFormat;

                /// <summary>
                /// The coordinates separator used the split the X and the Y coordinates in a string
                /// </summary>
                public const char CoordinatesSeparator = ';';
            }
        }
    }
}
